﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Resend.aspx.cs" Inherits="UI_Mail_Resend" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head runat="server">
    <title></title>
    <link href="../../js/jquery.easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../js/jquery.easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery.easyui/jquery.min.js" type="text/javascript"></script>
    <script src="../../js/jquery.easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script type="text/javascript">
     $(document).ready(function () {
       var eBayUserID = request.QueryString("ebayuserid");
       var orderID = request.QueryString("orderid");
       $('#resend').datagrid({
         fit: true,
         showHeader: false,
         url: '../../TableHanders.aspx?act=q&tid=8011&type=0',
         queryParams: { 'orderid': orderID, 'ebayuserid': eBayUserID },
         columns: [[
           { field: 'resendID', title: '重发订单号' },
         ]],
         view: cardview,
         onLoadSuccess: function(data) {
           for(i in data.rows) {
             var rebuildID = data.rows[i].OrderID;
             $('#ddv-' + i).datagrid({
               width: 665,
               url: '../../TableHanders.aspx?act=q&tid=8012&type=0',
               columns: [[
                 { field: 'ProdCode', title: '产品代码', width: 200},
                 { field: 'ProdName', title: '名称', width: 400 },
                 { field: 'Quantity', title: '数量', width: 60 }
               ]],
               queryParams: { 'ebayuserid': eBayUserID, 'orderid': rebuildID }
             });
           }
         }
       });
     });

     var cardview = $.extend({}, $.fn.datagrid.defaults.view, {
       renderRow: function(target, fields, frozen, rowIndex, rowData) {
         var cc = [];
         cc.push('<h1>重发订单号:' + rowData['OrderID'] + '</h1><hr />');
         cc.push('<table style="margin-bottom:5px;">');
         cc.push('<tr><td>' + rowData['BuyerName'] + '</td><td>发货单号: ' + rowData['ParcelID'] + '</td><td>' + rowData['RebuildReason'] + '</td></tr>');
         cc.push('<tr><td>' + rowData['BuyerStreet'] + '</td><td>发货时间: ' + rowData['ShippingDate'] + '</td><td>' + rowData['CreateUser'] + '</td></tr>');
         cc.push('<tr><td>' + rowData['BuyerCity'] + '</td><td>实际发货方式: ' + rowData['PostageService'] + '</td><td>备注</td></tr>');
         cc.push('<tr><td>' + rowData['BuyerCountry'] + '</td><td>发货公司: ' + rowData['ShippingService'] + '</td><td><input type="area" /></td></tr>');
         cc.push('<tr><td>' + rowData['BuyerZipCode'] + '</td><td>Tracking NO.: ' + rowData['TrackingNo'] + '</td></tr>');
         cc.push('<tr><td>' + rowData['BuyerPhoneNumber'] + '</td><td>重量: ' + rowData['Weight'] + '</td></tr>');
         cc.push('<tr><td>' + rowData['BuyerEmail'] + '</td><td>预计邮费: ' + rowData['Postage'] + '</td></tr>');
         cc.push('</table>');
         cc.push('<table id="ddv-' + rowIndex + '" style="margin:100px;"></table>');
         return cc.join('');
       }
     });
     var request = {
       QueryString: function (val) {
         var url = window.location.search;
         var re = new RegExp('' + val + '=([^&?]*)', 'ig');
         return ((url.match(re)) ? (url.match(re)[0].substr(val.length + 1)) : null);
       }
     };
    </script>
  </head>
  <body class="easyui-layout">
    <div region="center" style="padding:5px;" border="false">  
      <table id="resend"></table>
    </div>
  </body>
</html>
